package com.yyl.rbacs.shiro;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: rbacs
 * @BelongsPackage: com.yyl.rbacs.shiro
 * @Author: YuanSir
 * @CreateTime: 2022-10-28  11:03
 * @Description:
 * @Version: 1.0
 */

@Component
public class ShiroTag {
    
    /**
     * 是否拥有该权限
     * @param permission  权限标识
     * @return   true：是     false：否
     */
    public boolean hasPermission(String permission) {
        Subject subject = SecurityUtils.getSubject();
        return subject != null && subject.isPermitted(permission);
    }

}
